package com.qiantu.phone.ui.shotview;

import android.content.Context;
import android.view.View;

import com.qiantu.phone.R;
import com.qiantu.phone.ui.uiutil.LLDeviceUtil;
import com.qiantu.phone.widget.btnview.FiveButtonView;
import com.qiantu.phone.widget.btnview.OneButtonView;
import com.qiantu.phone.widget.btnview.OnBtnClickListener;

/**
 * @ClassName DeviceLightView
 * @Description TODO
 * @Author ShiJunqiang
 * @Date 2021/12/8 23:05
 * @Version 1.0
 */
public class SevenKeyShotView extends BaseDeviceActView {

    private FiveButtonView fiveButtonView;
    private OneButtonView btnView1;
    private OneButtonView btnView2;
    private String key;

    public SevenKeyShotView(Context context, String deviceType) {
        super(context, deviceType);
    }

    @Override
    public int getLayoutId() {
        return R.layout.seven_key_shot_view;
    }

    @Override
    public void initView() {
        fiveButtonView = findViewById(R.id.btn_five_view);
        btnView1 = findViewById(R.id.btn_view1);
        btnView2 = findViewById(R.id.btn_view2);
        if(deviceType.contains("wireless_433")){
            key = LLDeviceUtil.WIRELESS_CTRL_433;
        }else if(deviceType.contains("wireless_315")){
            key = LLDeviceUtil.WIRELESS_CTRL_315;
        }else if(deviceType.contains("infra-red")){
            key = LLDeviceUtil.IR_CTRL;
        }
        btnView1.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                addAct(key, "1");
            }
        });
        btnView2.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                addAct(key, "2");
            }
        });
        fiveButtonView.setOnBtnClickListener(new OnBtnClickListener() {
            @Override
            public void onClick(int btnID) {
                String value = String.valueOf(btnID + 2);
                addAct(key, value);
            }
        });
    }

    @Override
    public void updateView() {
    }
}
